import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MultipleContexts {
    public static void main(String[] args) {
        ApplicationContext first = new ClassPathXmlApplicationContext("classpath:multiplecontexts.xml");
        ApplicationContext second = new ClassPathXmlApplicationContext("classpath:multiplecontexts.xml");

        Person p1 = (Person) first.getBean("person");
        Person p2 = (Person) second.getBean("person");
        System.out.println(p1 == p2);

        Person p11 = (Person) first.getBean("person");
        System.out.println(p1 == p11);
    }
}